<?php
namespace Nawa\MedicalStudy\MedicalCenter\Monitoring;
/**
 * Monitoring PDF renderer
 *
 * It represant a status of the Medical Center Monitoring
 * 
 * @author Xavier VILAIN
 * @package Nawa\MedicalStudy\MedicalCenter\Monitoring
 * @license #license-nawa-output#
 * 
 */
use Nawa\Messages;

class Pdf extends \Fox\Renderer\Pdf {
		
	/**
	 * 
	 * Reference Message (for header)
	 * @var string
	 */
	protected $referenceMessage = null;
	
	/**
	 * Set PDF Title
	 * @param string $title
	 * @return Pdf
	 */
	public function setReference($ref = null) {
		$this->referenceMessage = $ref;
		return $this;
	}
	
	public $footerMessage = null;
	
	/**
	 * (non-PHPdoc)
	 * @see PHPPDF.Fpdf::Header()
	 */
	public function Header() {
	    // Logo
	    $this->Image(_IMAGES_.'logo.png',10,6,50);
	    // Police Arial gras 15
	    $this->SetFont('Arial','B',15);
	    // Right Position
	    $this->Cell(80);
	    // Titre
	    $this->Cell(30,10,$this->title,1,0,'C');
	    $this->SetFont('Arial','I',8);
	    $this->SetX(-35);
	    $pageRef = $this->referenceMessage."\n";
	    $pageRef .='Page '.$this->PageNo()."/{nb}";
		$this->MultiCell(30,5,$pageRef);
	    // Saut de ligne
	    $this->Ln(20);

	}

	/**
	 * (non-PHPdoc)
	 * @see PHPPDF.Fpdf::Footer()
	 */
	public function Footer() {
		if($this->PageNo() > 0) {
			// Positionnement a 1,5 cm du bas
			$this->SetY(-15);
			//$this->SetFillColor($r)
			 $this->SetFont('' ,'',self::FONT_SIZE_NORMAL);
			$this->MultiCell(0,5,$this->footerMessage,0,1,'L',true);
		}
	}
	
	/**
	 * Footer Message
	 * @param string $value
	 */
	public function footerMessage($value) {
		$this->footerMessage = $value;
	}
}